home *** CD-ROM | disk | FTP | other *** search
- Path: news.cern.ch!danpop
- From: danpop@mail.cern.ch (Dan Pop)
- Newsgroups: comp.lang.c
- Subject: Re: printing to printer???
- Date: 18 Apr 96 09:31:42 GMT
- Organization: CERN European Lab for Particle Physics
- Message-ID: <danpop.829819902@news.cern.ch>
- References: <829594324.796@smason.demon.co.uk> <4kutku$ggk@cheatum.frontiernet.net> <31755D9C.7775@hlp.com>
- NNTP-Posting-Host: ues5.cern.ch
- Mime-Version: 1.0
- Content-Type: text/plain; charset=US-ASCII
- Content-Transfer-Encoding: 7bit
- X-Newsreader: NN version 6.5.0 #18 (NOV)
-
- In <31755D9C.7775@hlp.com> andrew kennedy <"andrew kennedy"@hlp.com> writes:
-
- >delta4@frontiernet.net wrote:
- >>
- >> Jaden@smason.demon.co.uk (Sie) wrote:
- >>
- >> >Does anyone know how to print a string to a printer using Ansi C or
- >> >Microsoft C++v7????? TIA...
-
- ANSI C doesn't define the concept of printer, so any solution is
- platform/compiler specific.
-
- >> I been wondering the same thing (I use Power C, which is ANSI C
- >> compatible).
-
- ANSI C compliance is a useless feature as far as this topic is concerned.
- See above.
-
- > /* Filename: printit.cpp Written by A. Kennedy */
- > // Send output directly to printer
-
- You must have forgotten that you were posting to c.l.c :-)
- This is the only possible explanation for your syntax errors.
-
- > #include <stdio.h>
- > #include <stdlib.h>
-
- What do you need <stdlib.h> for?
-
- > #include <conio.h>
-
- This is both compiler specific and not needed here.
-
- > FILE *prnt;
- >
- > void main()
- ^^^^
- You also forgot to read the FAQ of the newsgroup before posting.
-
- > {
- > prnt = fopen("PRN", "w"); /* LTP1 would also work */
- ^^^^
- I beg to disagree :-)
-
- > fprintf(prnt, " This output was sent to the printer.");
-
- It will work much better with a newline appended. Otherwise, the user
- will have to play with the printer buttons or the next program will
- print on the same line, which is usually less than desirable.
-
- > fclose(prnt);
- > }
-
- Dan
- --
- Dan Pop
- CERN, CN Division
- Email: danpop@mail.cern.ch
- Mail: CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
-